#include "widget.h"
#include "ui_widget.h"
#include<QGridLayout>
#include<QPushButton>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);

    QGridLayout*layout=new QGridLayout();

    QPushButton* btn1=new QPushButton("按钮1");
    QPushButton* btn2=new QPushButton("按钮2");
    QPushButton* btn3=new QPushButton("按钮3");
    QPushButton* btn4=new QPushButton("按钮4");
    QPushButton* btn5=new QPushButton("按钮5");
    QPushButton* btn6=new QPushButton("按钮6");

    layout->addWidget(btn1,0,0);
    layout->addWidget(btn2,0,1);
    layout->addWidget(btn3,0,2);
    layout->addWidget(btn4,1,0);
    layout->addWidget(btn5,1,1);
    layout->addWidget(btn6,1,2);

    layout->setColumnStretch(0,1);
    layout->setColumnStretch(1,0);
    layout->setColumnStretch(2,3);



//    layout->addWidget(btn1,1,0);
//    layout->addWidget(btn2,2,0);
//    layout->addWidget(btn3,3,0);
//    layout->addWidget(btn4,4,0);

//    layout->addWidget(btn1,0,0);
//    layout->addWidget(btn2,1,1);
//    layout->addWidget(btn3,2,2);
//    layout->addWidget(btn4,3,3);


//    layout->addWidget(btn1,0,0);
//    layout->addWidget(btn2,1,0);
//    layout->addWidget(btn3,2,0);
//    layout->addWidget(btn4,10,0);

    this->setLayout(layout);
}

Widget::~Widget()
{
    delete ui;
}

